def main():
    y_or_n = input("是否退出程序(y/n)?")
    while y_or_n != "y":
        print("请输入以下信息，用空格隔离开")
        inputlist = input("性别 体重(Kg) 身高(CM) 年龄:" )
        try:
            input_list1 = inputlist.split(" ")
            gender = input_list1[0]
            weight = float(input_list1[1])
            height = float(input_list1[2])
            age = int(input_list1[3])
            if gender == "男":
                bmr = (13.7 * weight) + (5.0 * height) - (6.8 * age) +66
            elif gender == "女":
                bmr =(9.6 * weight) + (1.8 * height) - (4.7 * age) +655
            else:
                bmr =-1
            if bmr != -1:
                print("您的性别是{}，体重是{}公斤，身高是{}厘米,年龄是{}岁".format(gender, weight, height, age))
                print("您的基础代谢率:{}大卡".format(bmr))
            else:
                print("不支持该性别")
        except IndexError:
            print("请输入完整的信息！")
        except ValueError:
            print("请输入正确的信息！")
        except:
            print("程序异常！")
        print()
        y_or_n = input("是否退出程序(y/n)?")
if __name__ == "__main__":
    main()